# 狗
class Dog(object):
    def work(self):
        pass


# 军犬
class ArmyDog(Dog):
    def work(self):
        print('追击敌人...')


# 缉毒犬
class DrugDog(Dog):
    def work(self):
        print('追查毒品...')


# 人
class Person(object):
    def work_with_dog(self, dog):   # 传入的狗不同，执行不同的代码
        dog.work()

# 测试代码：
armydog = ArmyDog()
drugdog = DrugDog()

police = Person()

police.work_with_dog(armydog)
police.work_with_dog(drugdog)